package com.hxht.storage.server.pojo;

import java.util.Date;
import java.util.Set;
import java.util.UUID;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
//@Table(schema="storage")
public abstract class BaseRecordInfo extends BaseEntity {

	@ManyToOne//(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(nullable = false, name = "nvr_channel_info")
	private NvrIpchannelInfo ipChannel;
	
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(nullable = false, name = "device_channel_info")
	private VideoDeviceChannelInfo videoDeviceChannel;
	
	/** 录像时间点标记 */
	@OneToMany(mappedBy = "record", fetch = FetchType.EAGER,
			cascade = CascadeType.REMOVE)
	private Set<RecordMarkInfo> recordMarks;
	
	private String deviceId;
	
	private Integer deviceChannel;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date startTime;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date stopTime;
	
	private String userId;
	
	private String centerId;
	
	private Boolean isRecoding;
	
	/** 录像片段标识 */
	private String uuid;
	
	public BaseRecordInfo(){
		// 生成 录像片段的标识
		uuid = UUID.randomUUID().toString();
	}

	public NvrIpchannelInfo getIpChannel() {
		return ipChannel;
	}

	public void setIpChannel(NvrIpchannelInfo ipChannel) {
		this.ipChannel = ipChannel;
	}

	public VideoDeviceChannelInfo getVideoDeviceChannel() {
		return videoDeviceChannel;
	}

	public void setVideoDeviceChannel(VideoDeviceChannelInfo videoDeviceChannel) {
		this.videoDeviceChannel = videoDeviceChannel;
	}

	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}

	public Integer getDeviceChannel() {
		return deviceChannel;
	}

	public void setDeviceChannel(Integer deviceChannel) {
		this.deviceChannel = deviceChannel;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getStopTime() {
		return stopTime;
	}

	public void setStopTime(Date stopTime) {
		this.stopTime = stopTime;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getCenterId() {
		return centerId;
	}

	public void setCenterId(String centerId) {
		this.centerId = centerId;
	}

	public Boolean getIsRecoding() {
		return isRecoding;
	}

	public void setIsRecoding(Boolean isRecoding) {
		this.isRecoding = isRecoding;
	}

	public Set<RecordMarkInfo> getRecordMarks() {
		return recordMarks;
	}

	public void setRecordMarks(Set<RecordMarkInfo> recordMarks) {
		this.recordMarks = recordMarks;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

}
